﻿using System;
namespace CodeArt.SharePoint.DataProvider
{
    using System.Data;

    /// <summary>
    ///  IDbProvider
    /// </summary>
    public interface IDbProvider
    {

        IDbConnection Connection { get;  }
        IDbTransaction Transaction { get;  }

        IDbConnection OpenConnection();
        void CloseConnection();
        IDbTransaction BeginTransaction();
        IDbTransaction BeginTransaction(IsolationLevel isolationLevel);
        void CommitTransaction();
        void CommitTransaction(bool closeConnection);
        void RollBackTransaction();
        void RollBackTransaction(bool closeConnection);

        IDbDataAdapter CreateDataAdapter();
        IDbDataAdapter CreateDataAdapter(IDbCommand selectCommand);
        IDbCommand CreateCommand(CommandType commandType);
        IDbCommand CreateCommand(string sqlText, CommandType commandType);
       IDataParameter CreateParameter(string name);

        DataSet ExecuteDataSet(CommandType cmdType, string cmdText, params IDataParameter[] para);
        DataSet ExecuteDataSet(string cmdtext, params IDataParameter[] para);
        DataSet ExecuteDataSet(string cmdtext);
        int ExecuteNonQuery(CommandType cmdType, string cmdText, params IDataParameter[] commandParams);
        int ExecuteNonQuery(string cmdText, params IDataParameter[] commandParams);
        int ExecuteNonQuery(string cmdText);
        IDataReader ExecuteReader(CommandType cmdType, string cmdText, params IDataParameter[] commandParameters);
        object ExecuteScalar(string cmdText, params IDataParameter[] commandParameters);
        object ExecuteScalar(string cmdText);
        object ExecuteScalar(CommandType cmdType, string cmdText, params IDataParameter[] commandParameters);
        void PrepareCommand(IDbConnection con, IDbCommand cmd, CommandType cmdType, string cmdText, IDataParameter[] cmdParms);

        bool GetBool(object obj);
        byte Getbyte(object obj);
        byte[] GetByte(object obj);
        DateTime GetDateTime(object obj);
        decimal GetDecimal(object obj);
        Guid GetGuid(object obj);
        int GetInt(object obj);
        long GetLong(object obj);
        string GetString(object obj);
    }
}
